<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qtextlayout.cpp -->
  <title>QTextLine Class | Qt GUI 5.14.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.14</a></td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QTextLine</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtgui-index.html">Qt 5.14.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QTextLine Class</h1>
<!-- $$$QTextLine-brief -->
<p>The QTextLine class represents a line of text inside a <a href="qtextlayout.html">QTextLayout</a>. <a href="#details">More...</a></p>
<!-- @@@QTextLine -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QTextLine&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr></table></div><ul>
<li><a href="qtextline-members.html">List of all members, including inherited members</a></li>
</ul>
<p><b>Note:</b> All functions in this class are <a href="../qtdoc/threads-reentrancy.html">reentrant</a>.</p>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#CursorPosition-enum">CursorPosition</a></b> { CursorBetweenCharacters, CursorOnCharacter }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#Edge-enum">Edge</a></b> { Leading, Trailing }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#QTextLine">QTextLine</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#ascent">ascent</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#cursorToX">cursorToX</a></b>(int *<i>cursorPos</i>, QTextLine::Edge <i>edge</i> = Leading) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#cursorToX-1">cursorToX</a></b>(int <i>cursorPos</i>, QTextLine::Edge <i>edge</i> = Leading) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#descent">descent</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#draw">draw</a></b>(QPainter *<i>painter</i>, const QPointF &amp;<i>position</i>, const QTextLayout::FormatRange *<i>selection</i> = nullptr) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QGlyphRun&gt; </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#glyphRuns">glyphRuns</a></b>(int <i>from</i> = -1, int <i>length</i> = -1) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#height">height</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#horizontalAdvance">horizontalAdvance</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#isValid">isValid</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#leading">leading</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#leadingIncluded">leadingIncluded</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#lineNumber">lineNumber</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#naturalTextRect">naturalTextRect</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#naturalTextWidth">naturalTextWidth</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPointF </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#position">position</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#rect">rect</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#setLeadingIncluded">setLeadingIncluded</a></b>(bool <i>included</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#setLineWidth">setLineWidth</a></b>(qreal <i>width</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#setNumColumns">setNumColumns</a></b>(int <i>numColumns</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#setNumColumns-1">setNumColumns</a></b>(int <i>numColumns</i>, qreal <i>alignmentWidth</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#setPosition">setPosition</a></b>(const QPointF &amp;<i>pos</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#textLength">textLength</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#textStart">textStart</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#width">width</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#x">x</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#xToCursor">xToCursor</a></b>(qreal <i>x</i>, QTextLine::CursorPosition <i>cpos</i> = CursorBetweenCharacters) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtextline.html#y">y</a></b>() const</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QTextLine-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>A text line is usually created by <a href="qtextlayout.html#createLine">QTextLayout::createLine</a>().</p>
<p>After being created, the line can be filled using the <a href="qtextline.html#setLineWidth">setLineWidth</a>() or <a href="qtextline.html#setNumColumns">setNumColumns</a>() functions. A line has a number of attributes including the rectangle it occupies, <a href="qtextline.html#rect">rect</a>(), its coordinates, <a href="qtextline.html#x">x</a>() and <a href="qtextline.html#y">y</a>(), its <a href="qtextline.html#textLength">textLength</a>(), <a href="qtextline.html#width">width</a>() and <a href="qtextline.html#naturalTextWidth">naturalTextWidth</a>(), and its <a href="qtextline.html#ascent">ascent</a>() and <a href="qtextline.html#descent">descent</a>() relative to the text. The position of the cursor in terms of the line is available from <a href="qtextline.html#cursorToX">cursorToX</a>() and its inverse from <a href="qtextline.html#xToCursor">xToCursor</a>(). A line can be moved with <a href="qtextline.html#setPosition">setPosition</a>().</p>
</div>
<!-- @@@QTextLine -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$CursorPosition$$$CursorBetweenCharacters$$$CursorOnCharacter -->
<h3 class="fn" id="CursorPosition-enum"><a name="CursorPosition-enum"></a>enum QTextLine::<span class="name">CursorPosition</span></h3>
<div class="table"><table class="valuelist"><tr><th class="tblConst">Constant</th><th class="tblVal">Value</th></tr>
<tr><td class="topAlign"><code>QTextLine::CursorBetweenCharacters</code></td><td class="topAlign tblval"><code>0</code></td></tr>
<tr><td class="topAlign"><code>QTextLine::CursorOnCharacter</code></td><td class="topAlign tblval"><code>1</code></td></tr>
</table></div>
<!-- @@@CursorPosition -->
<!-- $$$Edge$$$Leading$$$Trailing -->
<h3 class="fn" id="Edge-enum"><a name="Edge-enum"></a>enum QTextLine::<span class="name">Edge</span></h3>
<div class="table"><table class="valuelist"><tr><th class="tblConst">Constant</th><th class="tblVal">Value</th></tr>
<tr><td class="topAlign"><code>QTextLine::Leading</code></td><td class="topAlign tblval"><code>0</code></td></tr>
<tr><td class="topAlign"><code>QTextLine::Trailing</code></td><td class="topAlign tblval"><code>1</code></td></tr>
</table></div>
<!-- @@@Edge -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QTextLine[overload1]$$$QTextLine -->
<h3 class="fn" id="QTextLine"><a name="QTextLine"></a>QTextLine::<span class="name">QTextLine</span>()</h3>
<p>Creates an invalid line.</p>
<!-- @@@QTextLine -->
<!-- $$$ascent[overload1]$$$ascent -->
<h3 class="fn" id="ascent"><a name="ascent"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTextLine::<span class="name">ascent</span>() const</h3>
<p>Returns the line's ascent.</p>
<p><b>See also </b><a href="qtextline.html#descent">descent</a>() and <a href="qtextline.html#height">height</a>().</p>
<!-- @@@ascent -->
<!-- $$$cursorToX[overload1]$$$cursorToXint*QTextLine::Edge -->
<h3 class="fn" id="cursorToX"><a name="cursorToX"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTextLine::<span class="name">cursorToX</span>(<span class="type">int</span> *<i>cursorPos</i>, <span class="type"><a href="qtextline.html#Edge-enum">QTextLine::Edge</a></span> <i>edge</i> = Leading) const</h3>
<p>Converts the cursor position <i>cursorPos</i> to the corresponding x position inside the line, taking account of the <i>edge</i>.</p>
<p>If <i>cursorPos</i> is not a valid cursor position, the nearest valid cursor position will be used instead, and <i>cursorPos</i> will be modified to point to this valid cursor position.</p>
<p><b>See also </b><a href="qtextline.html#xToCursor">xToCursor</a>().</p>
<!-- @@@cursorToX -->
<!-- $$$cursorToX$$$cursorToXintQTextLine::Edge -->
<h3 class="fn" id="cursorToX-1"><a name="cursorToX-1"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTextLine::<span class="name">cursorToX</span>(<span class="type">int</span> <i>cursorPos</i>, <span class="type"><a href="qtextline.html#Edge-enum">QTextLine::Edge</a></span> <i>edge</i> = Leading) const</h3>
<p>This is an overloaded function.</p>
<!-- @@@cursorToX -->
<!-- $$$descent[overload1]$$$descent -->
<h3 class="fn" id="descent"><a name="descent"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTextLine::<span class="name">descent</span>() const</h3>
<p>Returns the line's descent.</p>
<p><b>See also </b><a href="qtextline.html#ascent">ascent</a>() and <a href="qtextline.html#height">height</a>().</p>
<!-- @@@descent -->
<!-- $$$draw[overload1]$$$drawQPainter*constQPointF&constQTextLayout::FormatRange* -->
<h3 class="fn" id="draw"><a name="draw"></a><span class="type">void</span> QTextLine::<span class="name">draw</span>(<span class="type"><a href="qpainter.html">QPainter</a></span> *<i>painter</i>, const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>position</i>, const <span class="type"><a href="qtextlayout-formatrange.html">QTextLayout::FormatRange</a></span> *<i>selection</i> = nullptr) const</h3>
<p>Draws a line on the given <i>painter</i> at the specified <i>position</i>. The <i>selection</i> is reserved for internal use.</p>
<!-- @@@draw -->
<!-- $$$glyphRuns[overload1]$$$glyphRunsintint -->
<h3 class="fn" id="glyphRuns"><a name="glyphRuns"></a><span class="type">QList</span>&lt;<span class="type"><a href="qglyphrun.html">QGlyphRun</a></span>&gt; QTextLine::<span class="name">glyphRuns</span>(<span class="type">int</span> <i>from</i> = -1, <span class="type">int</span> <i>length</i> = -1) const</h3>
<p>Returns the glyph indexes and positions for all glyphs in this <a href="qtextline.html">QTextLine</a> for characters in the range defined by <i>from</i> and <i>length</i>. The <i>from</i> index is relative to the beginning of the text in the containing <a href="qtextlayout.html">QTextLayout</a>, and the range must be within the range of <a href="qtextline.html">QTextLine</a> as given by functions <a href="qtextline.html#textStart">textStart</a>() and <a href="qtextline.html#textLength">textLength</a>().</p>
<p>If <i>from</i> is negative, it will default to <a href="qtextline.html#textStart">textStart</a>(), and if <i>length</i> is negative it will default to the return value of <a href="qtextline.html#textLength">textLength</a>().</p>
<p>This function was introduced in Qt 5.0.</p>
<p><b>See also </b><a href="qtextlayout.html#glyphRuns">QTextLayout::glyphRuns</a>().</p>
<!-- @@@glyphRuns -->
<!-- $$$height[overload1]$$$height -->
<h3 class="fn" id="height"><a name="height"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTextLine::<span class="name">height</span>() const</h3>
<p>Returns the line's height. This is equal to <a href="qtextline.html#ascent">ascent</a>() + <a href="qtextline.html#descent">descent</a>() if leading is not included. If leading is included, this equals to <a href="qtextline.html#ascent">ascent</a>() + <a href="qtextline.html#descent">descent</a>() + <a href="qtextline.html#leading">leading</a>().</p>
<p><b>See also </b><a href="qtextline.html#ascent">ascent</a>(), <a href="qtextline.html#descent">descent</a>(), <a href="qtextline.html#leading">leading</a>(), and <a href="qtextline.html#setLeadingIncluded">setLeadingIncluded</a>().</p>
<!-- @@@height -->
<!-- $$$horizontalAdvance[overload1]$$$horizontalAdvance -->
<h3 class="fn" id="horizontalAdvance"><a name="horizontalAdvance"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTextLine::<span class="name">horizontalAdvance</span>() const</h3>
<p>Returns the horizontal advance of the text. The advance of the text is the distance from its position to the next position at which text would naturally be drawn.</p>
<p>By adding the advance to the position of the text line and using this as the position of a second text line, you will be able to position the two lines side-by-side without gaps in-between.</p>
<p>This function was introduced in Qt 4.7.</p>
<!-- @@@horizontalAdvance -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn" id="isValid"><a name="isValid"></a><span class="type">bool</span> QTextLine::<span class="name">isValid</span>() const</h3>
<p>Returns <code>true</code> if this text line is valid; otherwise returns <code>false</code>.</p>
<!-- @@@isValid -->
<!-- $$$leading[overload1]$$$leading -->
<h3 class="fn" id="leading"><a name="leading"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTextLine::<span class="name">leading</span>() const</h3>
<p>Returns the line's leading.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qtextline.html#ascent">ascent</a>(), <a href="qtextline.html#descent">descent</a>(), and <a href="qtextline.html#height">height</a>().</p>
<!-- @@@leading -->
<!-- $$$leadingIncluded[overload1]$$$leadingIncluded -->
<h3 class="fn" id="leadingIncluded"><a name="leadingIncluded"></a><span class="type">bool</span> QTextLine::<span class="name">leadingIncluded</span>() const</h3>
<p>Returns <code>true</code> if positive leading is included into the line's height; otherwise returns <code>false</code>.</p>
<p>By default, leading is not included.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qtextline.html#setLeadingIncluded">setLeadingIncluded</a>().</p>
<!-- @@@leadingIncluded -->
<!-- $$$lineNumber[overload1]$$$lineNumber -->
<h3 class="fn" id="lineNumber"><a name="lineNumber"></a><span class="type">int</span> QTextLine::<span class="name">lineNumber</span>() const</h3>
<p>Returns the position of the line in the text engine.</p>
<!-- @@@lineNumber -->
<!-- $$$naturalTextRect[overload1]$$$naturalTextRect -->
<h3 class="fn" id="naturalTextRect"><a name="naturalTextRect"></a><span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> QTextLine::<span class="name">naturalTextRect</span>() const</h3>
<p>Returns the rectangle covered by the line.</p>
<!-- @@@naturalTextRect -->
<!-- $$$naturalTextWidth[overload1]$$$naturalTextWidth -->
<h3 class="fn" id="naturalTextWidth"><a name="naturalTextWidth"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTextLine::<span class="name">naturalTextWidth</span>() const</h3>
<p>Returns the width of the line that is occupied by text. This is always &lt;= to <a href="qtextline.html#width">width</a>(), and is the minimum width that could be used by layout() without changing the line break position.</p>
<!-- @@@naturalTextWidth -->
<!-- $$$position[overload1]$$$position -->
<h3 class="fn" id="position"><a name="position"></a><span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> QTextLine::<span class="name">position</span>() const</h3>
<p>Returns the line's position relative to the text layout's position.</p>
<p><b>See also </b><a href="qtextline.html#setPosition">setPosition</a>().</p>
<!-- @@@position -->
<!-- $$$rect[overload1]$$$rect -->
<h3 class="fn" id="rect"><a name="rect"></a><span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> QTextLine::<span class="name">rect</span>() const</h3>
<p>Returns the line's bounding rectangle.</p>
<p><b>See also </b><a href="qtextline.html#x">x</a>(), <a href="qtextline.html#y">y</a>(), <a href="qtextline.html#textLength">textLength</a>(), and <a href="qtextline.html#width">width</a>().</p>
<!-- @@@rect -->
<!-- $$$setLeadingIncluded[overload1]$$$setLeadingIncludedbool -->
<h3 class="fn" id="setLeadingIncluded"><a name="setLeadingIncluded"></a><span class="type">void</span> QTextLine::<span class="name">setLeadingIncluded</span>(<span class="type">bool</span> <i>included</i>)</h3>
<p>Includes positive leading into the line's height if <i>included</i> is true; otherwise does not include leading.</p>
<p>By default, leading is not included.</p>
<p>Note that negative leading is ignored, it must be handled in the code using the text lines by letting the lines overlap.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qtextline.html#leadingIncluded">leadingIncluded</a>().</p>
<!-- @@@setLeadingIncluded -->
<!-- $$$setLineWidth[overload1]$$$setLineWidthqreal -->
<h3 class="fn" id="setLineWidth"><a name="setLineWidth"></a><span class="type">void</span> QTextLine::<span class="name">setLineWidth</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>width</i>)</h3>
<p>Lays out the line with the given <i>width</i>. The line is filled from its starting position with as many characters as will fit into the line. In case the text cannot be split at the end of the line, it will be filled with additional characters to the next whitespace or end of the text.</p>
<!-- @@@setLineWidth -->
<!-- $$$setNumColumns[overload1]$$$setNumColumnsint -->
<h3 class="fn" id="setNumColumns"><a name="setNumColumns"></a><span class="type">void</span> QTextLine::<span class="name">setNumColumns</span>(<span class="type">int</span> <i>numColumns</i>)</h3>
<p>Lays out the line. The line is filled from its starting position with as many characters as are specified by <i>numColumns</i>. In case the text cannot be split until <i>numColumns</i> characters, the line will be filled with as many characters to the next whitespace or end of the text.</p>
<!-- @@@setNumColumns -->
<!-- $$$setNumColumns$$$setNumColumnsintqreal -->
<h3 class="fn" id="setNumColumns-1"><a name="setNumColumns-1"></a><span class="type">void</span> QTextLine::<span class="name">setNumColumns</span>(<span class="type">int</span> <i>numColumns</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>alignmentWidth</i>)</h3>
<p>Lays out the line. The line is filled from its starting position with as many characters as are specified by <i>numColumns</i>. In case the text cannot be split until <i>numColumns</i> characters, the line will be filled with as many characters to the next whitespace or end of the text. The provided <i>alignmentWidth</i> is used as reference width for alignment.</p>
<!-- @@@setNumColumns -->
<!-- $$$setPosition[overload1]$$$setPositionconstQPointF& -->
<h3 class="fn" id="setPosition"><a name="setPosition"></a><span class="type">void</span> QTextLine::<span class="name">setPosition</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>pos</i>)</h3>
<p>Moves the line to position <i>pos</i>.</p>
<p><b>See also </b><a href="qtextline.html#position">position</a>().</p>
<!-- @@@setPosition -->
<!-- $$$textLength[overload1]$$$textLength -->
<h3 class="fn" id="textLength"><a name="textLength"></a><span class="type">int</span> QTextLine::<span class="name">textLength</span>() const</h3>
<p>Returns the length of the text in the line.</p>
<p><b>See also </b><a href="qtextline.html#naturalTextWidth">naturalTextWidth</a>().</p>
<!-- @@@textLength -->
<!-- $$$textStart[overload1]$$$textStart -->
<h3 class="fn" id="textStart"><a name="textStart"></a><span class="type">int</span> QTextLine::<span class="name">textStart</span>() const</h3>
<p>Returns the start of the line from the beginning of the string passed to the <a href="qtextlayout.html">QTextLayout</a>.</p>
<!-- @@@textStart -->
<!-- $$$width[overload1]$$$width -->
<h3 class="fn" id="width"><a name="width"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTextLine::<span class="name">width</span>() const</h3>
<p>Returns the line's width as specified by the layout() function.</p>
<p><b>See also </b><a href="qtextline.html#naturalTextWidth">naturalTextWidth</a>(), <a href="qtextline.html#x">x</a>(), <a href="qtextline.html#y">y</a>(), <a href="qtextline.html#textLength">textLength</a>(), and <a href="qtextline.html#rect">rect</a>().</p>
<!-- @@@width -->
<!-- $$$x[overload1]$$$x -->
<h3 class="fn" id="x"><a name="x"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTextLine::<span class="name">x</span>() const</h3>
<p>Returns the line's x position.</p>
<p><b>See also </b><a href="qtextline.html#rect">rect</a>(), <a href="qtextline.html#y">y</a>(), <a href="qtextline.html#textLength">textLength</a>(), and <a href="qtextline.html#width">width</a>().</p>
<!-- @@@x -->
<!-- $$$xToCursor[overload1]$$$xToCursorqrealQTextLine::CursorPosition -->
<h3 class="fn" id="xToCursor"><a name="xToCursor"></a><span class="type">int</span> QTextLine::<span class="name">xToCursor</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="qtextline.html#CursorPosition-enum">QTextLine::CursorPosition</a></span> <i>cpos</i> = CursorBetweenCharacters) const</h3>
<p>Converts the x-coordinate <i>x</i>, to the nearest matching cursor position, depending on the cursor position type, <i>cpos</i>. Note that result cursor position includes possible preedit area text.</p>
<p><b>See also </b><a href="qtextline.html#cursorToX">cursorToX</a>().</p>
<!-- @@@xToCursor -->
<!-- $$$y[overload1]$$$y -->
<h3 class="fn" id="y"><a name="y"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTextLine::<span class="name">y</span>() const</h3>
<p>Returns the line's y position.</p>
<p><b>See also </b><a href="qtextline.html#x">x</a>(), <a href="qtextline.html#rect">rect</a>(), <a href="qtextline.html#textLength">textLength</a>(), and <a href="qtextline.html#width">width</a>().</p>
<!-- @@@y -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
